<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="/WEB-INF/view/body/customer/myPage_form.jsp"/>
<script src="http://dmaps.daum.net/map_js_init/postcode.js"></script>
<script type="text/javascript" src="/${initParam.context_root}/script/script.js"></script>
<script type="text/javascript" src="/${initParam.context_root}/script/modifyform.js"></script>
<style type="text/css">
 	hr {border:#8D44AA 2px solid;}
  	p {color:white; font-size: 40px; background-color: #8D44AA; margin-left: 250px; margin-right: 250px; fon}
  	.headline {margin-top: 0px; margin-bottom: 10px;}
  	.headtext {font-weight: bolder; color:#8D44AA; margin-top: 20px; margin-bottom: 0px; font-style: 돋음; }
</style>
<script type="text/javascript">
$(document).ready(function(){
	$("#delete").on("click", function(){
		$("#form1").html("<form method='post' action='/${initParam.context_root }/customer/login/removeCustomer.do' onsubmit='return chk_out()'><div style='float:center'>"
		+"<input type='hidden' name='custId' value='${sessionScope.login_info.custId }'><input type='hidden' name='name' value='${sessionScope.login_info.name }'>"
		+"<input type='hidden' name='email' value='${sessionScope.login_info.email }'><table align='center'><tr><td width='400px;'><table id='modifyForm'>"
		+"<tr><td colspan='2'><h3 class='headtext'><b>회원탈퇴</b></h3></td></tr><tr><td colspan='3'><hr class='headline'></td></tr>"
		+"<tr><td width='120px'><label>ID</label></td><td>${sessionScope.login_info.custId }</td></tr>"
		+"<tr><td><label>NAME</label></td><td>${sessionScope.login_info.name }</td></tr>"
		+"<tr><td><label>생년월일</label></td><td>${sessionScope.login_info.birth }</td></tr>"
		+"<tr><td><label>EMAIL</label></td><td>${sessionScope.login_info.email }</td></tr>"
		+"<tr><td><label>연락처</label></td><td>${sessionScope.login_info.phone }</td></tr>"
		+"<tr><td><label>주소</label></td><td>${sessionScope.login_info.address }</td></tr>"	
		+"<tr><td><label>탈퇴 사유</label></td>"
		+"<td width='450px'><input type='text' class='form-control' placeholder='ex)사이트이용이 불편해서' name='outReason'></td></tr>"
		+"<tr style='height: 40px'><td colspan='2' align='right'><button type='submit' class='btn btn-danger btn-xs'>탈퇴</button>"
		+"</td></tr></tbody></table></td><td><img src='/${initParam.context_root }/img/modifyTip.jpg'/></tr></table></div></form>");
	});
});
function chk_out(){
	var flag = confirm("회원님의 정보는 모두 삭제됩니다. 정말 탈퇴하시겠습니까?");
	if(flag){
		window.close();
	}else{
		return false;		
	}
}
</script>

<br><br><br>
<div id="form1">
<form method="post" action="/${initParam.context_root }/customer/login/modify.do" onsubmit="return formCheck(this);">
	<div style="float:center">
		<input type="hidden" name="custId" value="${sessionScope.login_info.custId }">
		<table align="center">
			<tr>
				<td width="400px;">
					<table id="modifyForm">
						<tr>
							<td colspan='2'><h3 class='headtext'><b>회원정보수정</b></h3></td>
						</tr>
						<tr>
							<td colspan='3'><hr class='headline'></td>
						</tr>
						<tr>
							<td width="150px"><label>ID</label></td>
							<td>${sessionScope.login_info.custId }</td>
						</tr>
						<tr>
							<td><label>password</label></td>
							<td><input type="password" class="form-control" id="password" name="password"></td>
						</tr>
						<tr>
							<td><label>NAME</label></td>
							<td><input type="text" class="form-control" placeholder="${sessionScope.login_info.name }" id="name" name="name"></td>
						</tr>
						<tr>
							<td><label>BIRTH</label></td>
							<td><input type="text" class="form-control" placeholder="${sessionScope.login_info.birth }" id="birth" name="birth" ></td>
						</tr>
						<tr>
							<td><label>E-mail</label></td>
							<td><input type="text" class="form-control" placeholder="${sessionScope.login_info.email }" id="email" name="email"></td>
						</tr>
						<tr>
							<td><label>PHONE</label></td>
							<td><input type="text" class="form-control" placeholder="${sessionScope.login_info.phone }" id="phone" name="phone" ></td>
						</tr>
						<tr>
							<td><label>ADDRESS</label></td>
							<td><input type="text" class="form-control" placeholder="${sessionScope.login_info.address }" id="address" name="address" onclick="openDaumPostcode();"></td>
						</tr>
						<tr>
							<td><label>상세주소</label></td>
							<td><input type="text" class="form-control" placeholder="나머지 주소를 입력하세요" id="addr" name="addr" ></td>
						</tr>
						<tr style="height: 40px">
							<td colspan="2" align="right">
								<button type="submit" class="btn btn-info btn-xs" onclick="sum();">수정</button>
								<button type="reset" class="btn btn-warning btn-xs">취소</button>
								<button type="button" class="btn btn-danger btn-xs" id="delete">탈퇴</button>
							</td>
						</tr>
					</table>
				</td>
				<td><img src="/${initParam.context_root }/img/modifyTip.jpg"/>
			</tr>
		</table>
	</div>
</form>
</div>